var express = require('express');
var router = express.Router();
let { registerServe,searchUsersServe,loginServe} =require('../serve/usersServe')
/* GET users listing. */
router.get('/', function(req, res, next) {
  res.send('respond with a resource');
});

//注册
router.post('/register',async function(req,res,next){
    let data=await registerServe(req.body)
    res.send(data)
})
//查询用户
router.post('/searchUsers',async function(req,res,next){
    let data=await searchUsersServe(req.body)
    // console.log(data)
    res.send(data)
    // let res=await searchUsersServe()
})
//登录
router.post('/login',async function(req,res,next){
    let data=await loginServe(req.body)
    res.send(data)
})
module.exports = router;
